import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets
import preview from 'vue-photo-preview';
import 'vue-photo-preview/dist/skin.css';
Vue.use(preview);
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import locale from 'element-ui/lib/locale/lang/zh-CN' // lang i18n
Vue.use(ElementUI, locale)
// import ELEMENT from 'element-ui'
// Vue.use(ELEMENT)

// 日期处理
import moment from 'moment'

Vue.prototype.$moment = moment
moment.locale('zh-cn')

// 将自动注册所有组件为全局组件
// import dataV from '@jiaminghi/data-view'
// Vue.use(dataV)

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'

import '@/icons' // icon
import '@/permission' // permission control
import '@/injection'

import '@/assets/icon/iconfont.css'

import './permission' // permission control
import './utils/error-log' // error log

// 复制功能
import clipboard from 'vue-clipboard2'

Vue.use(clipboard)

import * as filters from './filters' // global filters

/**
 * If you don't want to use mock-server
 * you want to use MockJs for mock api
 * you can execute: mockXHR()
 *
 * Currently MockJs will be used in the production environment,
 * please remove it before going online ! ! !
 */
// if (process.env.NODE_ENV === 'production') {
//   const { mockXHR } = require('../mock')
//   mockXHR()
// }

// 全局载入自定义指令v-permission
import permission from '@/directive/permission/permission.js'

Vue.directive('permission', permission)
import permissionDisabled from '@/directive/permission/permission-disabled.js'

Vue.directive('permission-disabled', permissionDisabled)

import less from 'less'

Vue.use(less)

Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
